package xyz.bali16.module.netdisk.model.vo;

import org.mapstruct.*;
import org.mapstruct.factory.Mappers;
import xyz.bali16.module.netdisk.entity.FileFolder;

import java.util.List;

/**
 * @author bali2 on 2/11/2021.
 * @version 1.0
 */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface FileFolderFileVoConvert {
    FileFolderFileVoConvert INSTANCE = Mappers.getMapper(FileFolderFileVoConvert.class);

    @Named("toVo")
    //@Mapping(target = "size",defaultExpression = "java(new java.lang.Long(0L))")
    @Mapping(target = "size", constant = "0L")
    @Mapping(target = "type", constant = "-1")
    @Mapping(target = "relativeUrl", constant = "-1")
    FileVo map(FileFolder child);

    @IterableMapping(qualifiedByName = "toVo")
    List<FileVo> map(List<FileFolder> FileFolder);
}
